﻿using Jupiter.Infrastructure.Exceptions;
using Jupiter.Infrastructure.Responses;
using Wips.AppService.Publisher.Models;
using Wips.AppService.Publisher.Requests;
using Wips.Infrastructure.Model;

namespace Wips.AppService.Publisher
{
    /// <summary>
    /// 子服务查询
    /// </summary>
    public interface IAgentServerAppService
    {


        /// <summary>
        /// 获取注册的服务
        /// </summary>
        /// <returns></returns>
        Task<PageResult<AgentServerModel>> GetPageAsync(GetAgentServerPageRequest request);


        /// <summary>
        /// 获取单条子服务器信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="CoreException"></exception>
        Task<AgentServerConfigModel> GetByIdAsync(string id);


        /// <summary>
        /// 获取子服务的配置
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task<PageResult<AgentServerConfigModel>> GetAgentServerConfigsAsync(GetAgentServerConfigPageRequest request);


        /// <summary>
        /// 健康检查
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> CheckHealthyAsync(string id);


        /// <summary>
        /// 获取子服务器的盘符
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="CoreException"></exception>
        Task<List<string>> GetAgentRootPath(string id);
        /// <summary>
        /// 获取子服务器的文件夹 by目录
        /// </summary>
        /// <param name="id"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        /// <exception cref="CoreException"></exception>
        Task<List<DirectoryModel>> GetDirectoryAsync(string id, string path);


        /// <summary>
        /// 执行备份
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        Task<string> BackupAsync(BackupRequest request);


        /// <summary>
        /// 获取级联数据
        /// </summary>
        /// <returns></returns>
        Task<List<CascaderModel>> GetCascaderAsync();



        /// <summary>
        /// 获取文件文本内容
        /// </summary>
        /// <param name="id"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        /// <exception cref="CoreException"></exception>
        Task<string> GetFileTextAsync(string id, string path);


    }
}
